<template>
    <div>
        <!-- 头部 -->
        <home-header/>
        <!-- 轮播 -->
        <home-swiper :swiperList="swiperList"/>
        <!-- 功能Icons -->
        <home-icons :iconsList="iconsList"/>
        <!-- 本周热门榜单 -->
        <home-hot :hotsalelists="hotsalelists"/>
        <!-- 周末去哪儿 -->
        <home-weekend :weekendlists="weekendlists"/>
      
    </div>
</template>


<script>
import HomeHeader from '@/pages/home/components/HomeHeader'
import HomeSwiper from '@/pages/home/components/HomeSwiper'
import HomeIcons from '@/pages/home/components/HomeIcons'
import HomeHot from '@/pages/home/components/HomeHot'
import HomeWeekend from '@/pages/home/components/HomeWeekend'
export default {
        name:'Home',
        data() {
            return {
                msg: 'hello world',
                swiperList: [],
                iconsList: [],
                hotsalelists: [],
                weekendlists: []
            }
        },
        components: {
            HomeHeader,
            HomeSwiper,
            HomeIcons,
            HomeHot,
            HomeWeekend
        },
        methods: {
            getHomeInfo() {
                const _this = this;
                _this.$axios.get('/api/index.json').then(function(response) {

                    const res = response.data;
                    if (res.ret && res.data) {

                        console.log("请求成功...");

                        _this.swiperList = res.data.swiperList;
                        _this.iconsList = res.data.iconList;
                        _this.hotsalelists = res.data.hotsalelists;
                        _this.weekendlists = res.data.weekendlists;

                    }

                }).
                catch(function(error) {
                    console.log(error);
                });
            }
        },
        mounted() {
            this.getHomeInfo()
        }
    }
</script>


<style>

</style>
